HAL ADC state and error function migration

This section provides information about the HAL ADC state and error function migration.

HAL ADC get state

HAL1

HAL2

Functionality:

Return the ADC handle state (global state , errors state ,group state ,analog watchdogs state ,multi-mode state ).

Functionality:

Return the ADC handle state, group state, and common state.

Parameters:

hadc: ADC handle

Parameters:

hadc: Pointer to a hal_adc_handle_t structure. group: ADC group (regular or injected) for HAL_ADC_GetStateGroup .

Return Values:

ADC handle state (bitfield on 32 bits)

Return Values:

ADC handle state, group state, or common state (bitfield on 32 bits)

HAL_ADC_GetState(const ADC_HandleTypeDef *hadc);
HAL_ADC_GetState(const hal_adc_handle_t *hadc);
HAL_ADC_GetStateGroup(const hal_adc_handle_t *hadc, hal_adc_group_t group);
HAL_ADC_GetStateCommon(const hal_adc_handle_t *hadc);

Summary of Key Changes

  1. Two new functions are added to the get group and common states.

Related concepts: Revised and optimized HAL state machine


HAL ADC get error

HAL1

HAL2

Functionality:

Return the ADC error code, ADC error code can be a combination (bitfields) of the following values :

  • HAL_ADC_ERROR_NONE

  • HAL_ADC_ERROR_INTERNAL

  • HAL_ADC_ERROR_OVR

  • HAL_ADC_ERROR_DMA

  • …

Functionality:

Retrieve the HAL ADC last error codes, ADC last error can be a combination (bitfields) of the following values :

  • HAL_ADC_ERROR_NONE

  • HAL_ADC_ERROR_INTERNAL

  • HAL_ADC_REG_ERROR_OVR

  • HAL_ADC_REG_ERROR_DMA

  • …

Parameters:

hadc: ADC handle

Parameters:

hadc: Pointer to a hal_adc_handle_t structure.

Return Values:

ADC error code (bitfield on 32 bits)

Return Values:

Last error code (bitfield on 32 bits)

HAL_ADC_GetError(const ADC_HandleTypeDef *hadc);
HAL_ADC_GetLastErrorCodes(const hal_adc_handle_t *hadc);

Related concepts: Revised and optimized HAL error management